package com.wdj.creation.singleton.eagerSingleton;

import com.wdj.creation.singleton.staticfactory.Singleton;

/**
 * @ClassName EagerSingleton
 * @Description
 * @Author wdj
 * @Date 2020/8/20 23:05
 * @Version 1.0
 **/
public class EagerSingleton {
    private static EagerSingleton eagerSingleton = new EagerSingleton();
    private EagerSingleton(){}
    public static EagerSingleton getInstance(){
        return eagerSingleton;
    }

    public static void main(String[] args) {
        EagerSingleton singleton1 = EagerSingleton.getInstance();
        EagerSingleton singleton2 = EagerSingleton.getInstance();
        System.out.println(singleton1 == singleton2);
        System.out.println(singleton1.equals(singleton2));
    }
}
